cmake_minimum_required(VERSION 3.6)

set(lib_name ffmpeg)

project(${lib_name})

# -----macro: set openssl sub target-----
macro(set_ffmpeg_sub_target sub_lib_name)
  
  set(sub_target_name ${sub_lib_name})
  add_library(${sub_target_name} STATIC IMPORTED GLOBAL)

  set_target_properties(${sub_target_name} PROPERTIES
    INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/include"
  )
  set_target_properties(${sub_target_name} PROPERTIES
    IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/prebuild/android/${ANDROID_ABI}/lib${sub_lib_name}.a"
  )
endmacro()

set(target_name avutil)
set_ffmpeg_sub_target(${target_name})

set(target_name avdevice)
set_ffmpeg_sub_target(${target_name})

set(target_name avcodec)
set_ffmpeg_sub_target(${target_name})

set(target_name avfilter)
set_ffmpeg_sub_target(${target_name})

set(target_name swresample)
set_ffmpeg_sub_target(${target_name})

set(target_name swscale)
set_ffmpeg_sub_target(${target_name})

set(target_name avformat)
set_ffmpeg_sub_target(${target_name})

#set(target_name postproc)
#set_ffmpeg_sub_target(${target_name})
#
#set(target_name fdk-aac)
#set_ffmpeg_sub_target(${target_name})

#set(target_name x264)
#set_ffmpeg_sub_target(${target_name})